package cn.com.jenson.web.main.controller;

import cn.com.jenson.common.BasicController;
import cn.com.jenson.common.ImportVerifierVo;
import cn.com.jenson.common.Result;
import cn.com.jenson.common.SelectVo;
import cn.com.jenson.entity.main.Story;
import cn.com.jenson.service.main.service.StoryService;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api/main/story")
public class StoryController implements BasicController<Story, Story, Story> {

    @Resource
    StoryService storyService;

    @Override
    public Result<Page<Story>> pageAll(@RequestBody Story story) {
        return Result.suc(storyService.pageAll(story));
    }

    @Override
    public Result<List<Story>> listAll(@RequestBody Story story) {
        return Result.suc(storyService.listAll(story));
    }

    @Override
    public Result<Story> get(@RequestBody Story story) throws InstantiationException, IllegalAccessException {
        return Result.suc(storyService.get(story));
    }

    @Override
    public Result<Story> edit(@RequestBody Story story) throws InstantiationException, IllegalAccessException {
        return Result.suc(storyService.edit(story));
    }

    @Override
    public Result<List<Story>> editAll(@RequestBody List<Story> stories) {
        return null;
    }

    @Override
    public Result<Story> deleted(@RequestBody Story story) throws InstantiationException, IllegalAccessException {
        return Result.suc(storyService.deleted(story));
    }

    @Override
    public Result<List<Story>> deletedAll(@RequestBody List<Story> stories) throws InstantiationException, IllegalAccessException {
        return null;
    }

    @Override
    public List<ImportVerifierVo> importTemplateVerifiers() {
        return null;
    }

    @Override
    public void importTemplateDownload(HttpServletResponse response) throws IOException {

    }

    @Override
    public Result<List<SelectVo<String, Integer, Story>>> option() {
        return null;
    }
}
